/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 简单的英雄id，只用来同步属性
	/// module : levelLogic
	/// </summary>
	public class LevelHeroAttrSyncPOD : IPOD 
    {
        public readonly static Func<LevelHeroAttrSyncPOD> FACTORY = () => new LevelHeroAttrSyncPOD();
		public static Func<LevelHeroAttrSyncPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        /// 
        /// </summary>
		public long id;
		/// <summary>
        /// 当前血量
        /// </summary>
		public int hp;
		/// <summary>
        /// 当前蓝量
        /// </summary>
		public int sp;
		
		
		
		/*-- constructors --*/
		public LevelHeroAttrSyncPOD() {}
		public LevelHeroAttrSyncPOD(long id, int hp, int sp) {
			this.id = id;
			this.hp = hp;
			this.sp = sp;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_long(id);
            _out.Write_int(hp);
            _out.Write_int(sp);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            id = _in.Read_long();
            if(!_in.HasRemaining()) return;
            hp = _in.Read_int();
            if(!_in.HasRemaining()) return;
            sp = _in.Read_int();
        }
		
		public LevelHeroAttrSyncPOD Clone() {
            LevelHeroAttrSyncPOD o = DynamicFactory();
            o.id = id;
            o.hp = hp;
            o.sp = sp;
            return o;
        }
        
        public void Clear() {
            id = default;
            hp = default;
            sp = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "LevelHeroAttrSyncPOD [";
			str += "id=";
			str += id;
			str += ", hp=";
			str += hp;
			str += ", sp=";
			str += sp;
			str += "]";
			return str;
		}
		
	}
}